package com.example.demo.domain;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.lang.annotation.Native;
import java.util.List;
import java.util.Map;

public interface DynamicRespository extends JpaRepository<Dynamic,Long> {
    @Query(value = "select d.id,d.img_url,d.dynamic_title,d.dynamic_info,d.time_stamp,u.name from dynamic d ,user u where u.id=d.user_id",nativeQuery = true)
    List<Map<String,String>> queryAllNews();

    @Query(value = "select * from dynamic where id=?1",nativeQuery = true)
    List<Map<String,String>> getDynamicInfo(Long id);
}
